<template>
	<view style="background-color: #fff;">
		<uni-indexed-list :options="list" :show-select="false" @click="bindClick" />
	</view>
</template>

<script>
	import {
		mapGetters
	} from "vuex";
	export default {
		computed: {
			...mapGetters(['cateList']),
			list() {
				let letter = Array.from(new Set(this.cateList.map(_ => _.cat_first_letter)))
				let list = []
				if (letter.length) {
					for (let i = 0; i < letter.length; i++) {
						list.push({
							letter: letter[i],
							data: this.cateList.filter(v => v.cat_first_letter === letter[i]).map(_ => _.cat_name)
						})
					}
				}
				return list
			}
		},
		data() {
			return {}
		},
		methods: {
			bindClick() {
				uni.navigateTo({
					url: '/subpkg/reading/submit'
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	/deep/ .uni-indexed-list__menu-item{
		background-color: #fff;
	}
	/deep/ .uni-indexed-list__title-wrapper {
		background-color: #fff;
	}

	/deep/ .uni-indexed-list__list {
		background-color: #fff;
	}
</style>
